package com.weipai.turnplate.service.impl;

import com.weipai.turnplate.service.FileUploadService;
import com.weipai.turnplate.util.FileUploadUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;


/**
 * @Author: 赵项阳
 * @Date: 2019/6/6 19:02
 * @Version 1.0
 */
@Service
public class FileUploadServiceImpl implements FileUploadService {
    private final static Logger logger = LoggerFactory.getLogger(FileUploadServiceImpl.class);

    @Override
    public String saveImgUpload(HttpServletRequest request,MultipartFile file) {
        String uploadStatus = null;
        try {
            uploadStatus = FileUploadUtil.ImgSave(request,file);
            //uploadStatus = yuanFilePath+newImgName;
        } catch (Exception e) {
            logger.error("服务器内部错误", e);
            uploadStatus = "error";
        }
        return uploadStatus;
    }
}
